<template>
	<view class="teacher-page">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<view style="height: 20rpx;"></view>
			<view class="teacher-list">
				<view class="teacher-item" v-for="(item,index) in dataList" :key="index"
					@click="$Tips('/pages/courses/teacherDetail?teacher_id='+item.id)">
					<image :src="item.image" class="item-left"></image>
					<view class="item-right">
						<view class="item-title">{{item.name}}</view>
						<view class="item-time">{{item.description}}</view>
					</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
			}
		},
		onShow() {
			this.refreshList()
		},
		methods: {
			refreshList() {
				this.$refs.paging.scrollToTop()
				this.$refs.paging.refresh();
			},
			queryList(pageNo, pageSize) {
				this.$Api.courses.merchantTeacher({
					page: pageNo,
					limit: pageSize,
				}).then(res => {
					this.$refs.paging.complete(res.data.data);
				}).catch(res => {
					this.$refs.paging.complete(false);
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.teacher-page {
		width: 100%;
		min-height: 100vh;
		background: #F6F6F8;

		.teacher-list {
			margin: 0rpx 30rpx;

			.teacher-item {
				display: flex;
				align-items: center;
				margin-bottom: 20rpx;
				box-sizing: border-box;
				padding: 26rpx 20rpx;
				box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0, 0, 0, 0.1), inset 0rpx 2rpx 2rpx 0rpx #FFFFFF;
				border-radius: 28rpx;
				background: #ffffff;

				.item-left {
					width: 128rpx;
					height: 128rpx;
					border-radius: 50%;
					margin-right: 20rpx;
				}

				.item-right {
					flex: 1;
					height: 128rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.item-title {
						font-weight: bold;
						font-size: 32rpx;
					}

					.item-time {
						font-size: 26rpx;
						color: #565656;
						margin-top: 16rpx;
						width: 400rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}
			}
		}
	}
</style>